﻿using DiaoPaiDaYin;
using DXApplicationTangche.service;
using DXApplicationTangche.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static DXApplicationTangche.原型.TaskDTOS;

namespace DXApplicationTangche.UC.任务
{
    public partial class Frm样品设计点任务 : DevExpress.XtraEditors.XtraForm
    {
        public String ORDER_ID { get; set; }
        public ImageUtil imageUtil { get; set; }
        public Frm样品设计点任务()
        {
            InitializeComponent();
        }
        public Frm样品设计点任务(String orderid)
        {
            this.ORDER_ID = orderid;
            InitializeComponent();
        }
        private void barButtonItem保存_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                String file_name = @"" + this.ORDER_ID + "_" + System.Guid.NewGuid().ToString("N") + ".doc";
                this.richEditControl设计点描述.SaveDocument(file_name, DevExpress.XtraRichEdit.DocumentFormat.Doc);
                Byte[] byteArray = FileBinaryConvertHelper.File2Bytes(file_name);
                String str = Convert.ToBase64String(byteArray);
                Updata设计点描述文档(str, this.ORDER_ID);
                MessageBox.Show("保存成功");
                this.Close();
            }
            catch
            {
                MessageBox.Show("保存失败");
            }
        }
        public static void Updata设计点描述文档(String str, String orderid)
        {
            try
            {
                SQLmtm.DoUpdate("t_remark", new string[] { "remark" }, new string[] { str }, new string[] { "order_id", "template_id" }, new string[] { orderid, ((int)Enum样衣子任务.设计点任务).ToString() });
            }
            catch
            {
            }
        }

        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.imageUtil = FileService.updateTempalteFile(MIMEConst.IMAGE_MIME, this.imageUtil);
            this.pictureBoxImage.Image = this.imageUtil.image;
        }
    }
}
